package com.hoapital.outpbillwork.module.controller;

import com.alibaba.fastjson.JSON;
import com.hospital.common.core.module.controller.vo.OrderInfo;
import com.hospital.common.core.result.ErrorTip;
import com.hospital.common.core.result.Tip;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * @author lvyao
 * @description 门诊就诊
 * @date 2022/2/24
 */
@RestController
@RequestMapping("/visitwork")
@Slf4j
public class OutpVisitController {
    /**
     * 门诊挂号
     *
     * @param requestVal
     * @param request
     * @return
     */
    @PostMapping(value = "/register", produces = {"application/json;charset=UTF-8"})
    public Tip getRegister(@RequestBody String requestVal, HttpServletRequest request) {
        String retunStr = null;
        Tip tip = null;
        OrderInfo orderInfo = null;
        try {
            orderInfo = JSON.parseObject(requestVal, OrderInfo.class);
        } catch (Exception e) {
            tip = new ErrorTip("1001", "入参格式转换出错:" + e.getMessage());
            return tip;
        }

        return tip;
    }

    /**
     * 门诊病历填写
     *
     * @param requestVal
     * @param request
     * @return
     */
    @PostMapping(value = "/visit", produces = {"application/json;charset=UTF-8"})
    public Tip getVisit(@RequestBody String requestVal, HttpServletRequest request) {
        String retunStr = null;
        Tip tip = null;
        OrderInfo orderInfo = null;
        try {
            orderInfo = JSON.parseObject(requestVal, OrderInfo.class);
        } catch (Exception e) {
            tip = new ErrorTip("1001", "入参格式转换出错:" + e.getMessage());
            return tip;
        }

        return tip;
    }
}
